﻿using System;
using NUnit.Framework;
using Crap4Net.CoverageParsers;

namespace Crap4Net.UnitTests.CoverageParsersTests
{
    [TestFixture]
    public class CoverageParserFactoryTests
    {
        [Test]
        public void CreateParser_AskedForMSTestCoverage_ReturnVSCoverageParser()
        {
            var actual = CoverageParserFactory.CreateParser(CoverageParserFactory.MSTEST_TOOL_NAME);

            Assert.IsInstanceOf<VSCoverageParser>(actual);
        }

        [Test]
        public void CreateCCParser_AskedForMSTestXMLParsel_ReturnsVsXmlParser()
        {
            var actual = CoverageParserFactory.CreateParser(CoverageParserFactory.MSTESTXML_TOOL_NAME);

            Assert.IsInstanceOf<VsXmlParser>(actual);
        }

        [Test]
        public void CreateCCParser_AskedForPartCoverParser_ReturnsPartCoverageParser()
        {
            var actual = CoverageParserFactory.CreateParser(CoverageParserFactory.PARTCOVER_TOOL_NAME);

            Assert.IsInstanceOf<PartCoverageParser>(actual);
        }

        [Test]
        public void CreateCCParser_AskedForIllegalParser_ThrowsException()
        {
            Assert.Throws<ArgumentException>(() => CoverageParserFactory.CreateParser("no_Such_tool"));

        }

    }
}
